#!/bin/sh
#
#
#   Description :
#     altera bourne script for the Design Architect.  This script is called during
#     command line invocation (i.e. /idea/bin/max2_da) and is used to set the 
#     userware search path and to invoke the Design Architect.
#
#   Change History :
#     Date      Who                            What
#     --------  -----------------------------  ------------------------------------------
#     08-13-91  MGC                            FCS release
#
#

case "$MGC_HOME" in
 "") echo "The environment variable MGC_HOME is null or not set.">&2
    if [ -s /idea/bin/set_mgc_env ]; then
        echo "There is an MGC software tree at /idea; setting MGC_HOME to /idea.">&2
        MGC_HOME="/idea"
        export MGC_HOME
    else
        echo "Please set MGC_HOME to the location of the MGC software tree.">&2
        exit 1
    fi
 ;;
 *) if [ ! -s $MGC_HOME/bin/set_mgc_env ]; then
        echo "MGC_HOME is set to $MGC_HOME, which is not a valid MGC software tree.">&2
        echo "Please set MGC_HOME to the location of the MGC software tree.">&2
        exit 1
    fi
 ;;
esac

. $MGC_HOME/bin/set_mgc_env

MAX2_AMPLE_PATH="`$MGC_HOME/bin/get_hard_name -s '$MAX2_MENTOR/userware/default'`"
if [ $? -ne 0 ]; then
    echo "Error: Can not determine value of \$MAX2_MENTOR.  Should be set to /usr/maxplus2/mentor/max2"
    exit 1
else
    export MAX2_AMPLE_PATH
fi
AMPLE_PATH=$MAX2_AMPLE_PATH:$AMPLE_PATH; export AMPLE_PATH

MAX2_TYPE_REGISTRY="`$MGC_HOME/bin/get_hard_name -s '$MAX2_MENTOR/max2.rgy'`"
if [ $? -ne 0 ]; then
    echo "Error: Can not determine value of \$MAX2_MENTOR.  Should be set to /usr/maxplus2/mentor/max2"
    exit 1
else
    export MAX2_TYPE_REGISTRY
fi
MGC_TYPE_REGISTRY=$MAX2_TYPE_REGISTRY:$MGC_TYPE_REGISTRY; export MGC_TYPE_REGISTRY

#
da_cmd="`$MGC_HOME/bin/resolve_mgc_path '$MGC_HOME/bin/da'`"

$da_cmd -nocable $@

